<?php
include 'dbconfig.php';
include 'opendb.php';

$username= $_POST['username'];
$password= $_POST['password'];

$result = login($username, $password);
if($result)
$result = getUserID($username, $password);
else
$result = '';
echo $result;

function login ($username, $password){
	$result = mysql_query ("SELECT * FROM wp_users WHERE user_login = '$username' AND user_pass = '$password'");
	return mysql_numrows($result);
}

function getUserID ($username, $password){
	$rows = mysql_query ("SELECT ID FROM wp_users WHERE user_login = '$username' AND user_pass = '$password'");
	$result = mysql_result ($rows, 0, 'ID');
	return $result;
}
?>